home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 July / Chip_1998-07_cd.bin / zkuste / mazda / mazIn311.dxr / Internal_19_Image Cycle Cast Members.ls < prev    next >
Encoding:
Text File  |  1998-05-06  |  3.9 KB  |  89 lines

  1. property enabled, membermin, membermax, ImageCastLib, MemberRefMin, MemberRefMax, CycleStyle, goingDown, currentstate, numstates, name
  2.  
  3. on CycleState me, name
  4.   if name = the name of me then
  5.     bumpstate_intern(me)
  6.   end if
  7. end
  8.  
  9. on setstate me, statenum
  10.   if the enabled of me then
  11.     if statenum > the numstates of me then
  12.       set statenum to the numstates of me
  13.     else
  14.       if statenum < 1 then
  15.         set statenum to 1
  16.       end if
  17.     end if
  18.     set the member of sprite the spriteNum of me to member (the membermin of me + statenum - 1) of castLib ImageCastLib
  19.   end if
  20. end
  21.  
  22. on setgoingDown me, value
  23.   set the goingDown of me to value
  24. end
  25.  
  26. on SetCycleStyle me, value
  27.   set the CycleStyle of me to value
  28. end
  29.  
  30. on bumpstate_intern me
  31.   if the enabled of me then
  32.     if the CycleStyle of me = #repeat then
  33.       if not (the goingDown of me) then
  34.         set curr to the currentstate of me + 1
  35.         if curr > the numstates of me then
  36.           set curr to 1
  37.         end if
  38.       else
  39.         set curr to the currentstate of me - 1
  40.         if curr < 1 then
  41.           set curr to the numstates of me
  42.         end if
  43.       end if
  44.     else
  45.       if not (the goingDown of me) then
  46.         set curr to the currentstate of me + 1
  47.         if curr > the numstates of me then
  48.           set curr to curr - 2
  49.           set the goingDown of me to 1
  50.         end if
  51.       else
  52.         set curr to the currentstate of me - 1
  53.         if curr < 1 then
  54.           set curr to 2
  55.           set the goingDown of me to 0
  56.         end if
  57.       end if
  58.     end if
  59.     set the currentstate of me to curr
  60.     setstate(me, curr)
  61.   end if
  62. end
  63.  
  64. on beginSprite me
  65.   set the enabled of me to 1
  66.   set the membermin of me to the memberNum of member MemberRefMin
  67.   set the membermax of me to the memberNum of member MemberRefMax
  68.   set the numstates of me to the membermax of me - the membermin of me + 1
  69.   set the currentstate of me to the memberNum of sprite the spriteNum of me - the membermin of me + 1
  70.   set the ImageCastLib of me to the number of castLib the castLibNum of sprite the spriteNum of me
  71.   setstate(me, the currentstate of me)
  72. end
  73.  
  74. on getPropertyDescriptionList
  75.   if the currentSpriteNum = 0 then
  76.     set memdefault to 0
  77.   else
  78.     set memref to the member of sprite the currentSpriteNum
  79.     set castLibNum to the castLibNum of memref
  80.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  81.   end if
  82.   set p_list to [#name: [#comment: "Item Name:", #format: #symbol, #default: #MultiState_1], #MemberRefMin: [#comment: "First Image:", #format: #graphic, #default: memref], #MemberRefMax: [#comment: "Last Image:", #format: #graphic, #default: memdefault], #CycleStyle: [#comment: "Cycle Style:", #format: #symbol, #range: [#repeat, #Reverse], #default: #repeat], #goingDown: [#comment: "Reverse Order:", #format: #boolean, #default: 0]]
  83.   return p_list
  84. end
  85.  
  86. on getBehaviorDescription
  87.   return "Makes the sprite cycle through a range of cast members when the CycleState message is received." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Item Name - (optional) Enter an item name to identify the current sprite so that it can receive a specific message. Do not use spaces. Use the name as an argument for the Message Sprite or Message All Sprites behaviors." & RETURN & "ΓÇó First Image - Enter the name of the first cast member in the cycling range." & RETURN & "ΓÇó Last Image  - Enter the name of the last cast member in the cycling range." & RETURN & "ΓÇó Cycle Mode - Choose Repeat to repeat the same sequence.  Choose Reverse to cycle back through the sequence in reverse order." & RETURN & "ΓÇó Reverse Order - Turn this option on to proceed from the last to the first image by default." & RETURN & "MESSAGES:" & RETURN & "ΓÇó CycleState - Switches the sprite's cast member to the next image in the sequence." & RETURN & "ΓÇó SetState state_number - Advances directly to the position in the sequence identified by state_number."
  88. end
  89.